﻿using System.Web.Mvc;
using EPiServer.Community.Blog;
using JoelAbrahamsson.BlogExtensions;

namespace JoelAbrahamsson.Web.Controllers
{
    public class LatestPostsController : Controller
    {
        private ExtendedBlogHandlerFacade blogHandler;

        public LatestPostsController(ExtendedBlogHandlerFacade blogHandler)
        {
            this.blogHandler = blogHandler;
        }

        public ActionResult Index(Blog blog)
        {
            int totalItems;
            EntryCollection latestPosts = blogHandler.GetLatestEntries(blog, 1, 4, out totalItems);

            return View(latestPosts);
        }

    }
}
